<?php
/**
 * class App_Form_User_Login
 * common user login form
 *
 */
class App_Form_User_Login extends Zend_Form
{
    /**
     * init function - add elements
     *
     * @return object
     */
    public function init()
    {
        $this->setMethod('post');

        $this->addElement('text', 'email', array(
            'required'   => true,
            'label'      => 'Email: ',
            'filters'    => array('StringTrim'),
            'validators' => array('EmailAddress')
        ));

        $this->addElement('password', 'password', array(
            'required'   => true,
            'label'      => 'Password: ',
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 128))
            )
        ));

        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'login',
        ));

        // And finally add some CSRF protection
        //$this->addElement('hash', 'csrf', array('ignore' => true));
    }

}